package com.ces.chain.sample;
/*
 * @Author wuchengcheng
 * @Date 2019-10-13 15:50
 */

import com.ces.chain.Interceptor;
import com.ces.chain.Invocation;
import com.ces.chain.annon.Intercepts;
import com.ces.chain.annon.Signature;
import org.springframework.core.annotation.Order;

@Order(2)
@Intercepts({@Signature(type = Handler.class, method = "handle", args = {Integer.class})})
public class BMJLHandler implements Interceptor {
    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        Object[] args = invocation.getArgs();
        int days = (int) args[0];
        if (days < 10&&days>3) {
            System.out.println("处理部门经理审批的逻辑");
            return null;
        }
        Handler target = (Handler)invocation.getTarget();
        return target.handle(days);
    }
  
}
